<template>
    <div class="child">
        子组件：
        <div>展示父组件数据：{{ $attrs.name }}</div>
        <button @click="onClick($parent)">修改父组件数据</button>
    </div>
</template>

<script setup lang="ts">
    import { useAttrs } from 'vue';

    const $attrs = useAttrs();

    function onClick($parent: any) {
        console.log($parent);
        $parent.money = 200;
    }
</script>

<style scoped>
    .child {
        width: 600px;
        height: 300px;
        background: skyblue;
    }
</style>
